package com.example.back_code.controller;

import com.example.back_code.entity.po.Paper;
import com.example.back_code.service.PaperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/paper")
public class PaperController {

    @Autowired
    private PaperService paperService;

    @GetMapping("/list")
    public List<Paper> list() {
        return paperService.list();
    }

    @PostMapping("/add")
    public boolean add(@RequestBody Paper paper) {
        return paperService.save(paper);
    }

    @PutMapping("/update")
    public boolean update(@RequestBody Paper paper) {
        return paperService.updateById(paper);
    }

    @DeleteMapping("/delete/{id}")
    public boolean delete(@PathVariable Long id) {
        return paperService.removeById(id);
    }
} 